<script>
export default {
  name: "animateView",
  data(){
    return{
      flag:true
    }
  },
  methods:{
    boxShow(){
          this.flag=!this.flag
    }
  }
}
</script>

<template>
  <div>
    <transition>
      <button @click="boxShow">改变盒子</button>

    </transition>
    <div class="box" v-if="flag">

    </div>
  </div>

</template>

<style scoped lang="less">
.box{
  width: 200px;
  height: 200px;
  background: #42b983;
}
</style>